<?php

declare(strict_types=1);

namespace App\Request\Setting;

use App\Request\BaseCommonRequest;
use Hyperf\Context\Context;
use Hyperf\Validation\Request\FormRequest;

class SetPriceRequest extends BaseCommonRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }


    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'type' => 'required|in:1,2,3'
        ];
    }


    public function messages(): array
    {
        $language = Context::get('language');
        if ($language == 'zh-zn') {
            return [
                'type.required' => '价格类型必填',
                'type.in' => '价格类型只能是1,2，3',
            ];
        } elseif ($language == 'zh-hk') {
            return [
                'type.required' => '價格類型必填',
                'type.in' => '價格類型只能是1,2，3',
            ];
        } else {
            return [
                'type.required' => 'Price type is required',
                'type.in' => 'Price type can only be 1,2,3',
            ];
        }
    }
}
